﻿Core = {};
/**
* A function used to extend one class with another
* 
* @param {Object} subClass
* 		The inheriting class, or subclass
* @param {Object} baseClass
* 		The class from which to inherit
*/
Core.Inherit = function(subClass, baseClass) {
    function inheritance() { }
    inheritance.prototype = baseClass.prototype;

    subClass.prototype = new inheritance();
    subClass.prototype.constructor = subClass;
    subClass.baseConstructor = baseClass;
    subClass.superClass = baseClass.prototype;
}

Core.Clone = function(o) {
    if (!o || 'object' !== typeof o) {
        return o;
    }
    var c = 'function' === typeof o.pop ? [] : {};
    var p, v;
    for (p in o) {
        if (o.hasOwnProperty(p)) {
            v = o[p];
            if (v && 'object' === typeof v) {
                c[p] = Core.Clone(v);
            }
            else {
                c[p] = v;
            }
        }
    }
    return c;
}

Core.GetNewGuid = function() {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
        var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
        return v.toString(16);
    });
    //}).toUpperCase().replace(/-/g, '_');
}